<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script src="../js/vue.js"></script>
    <div id ="app">
        <p>{{price}}</p>
        <button @click="price+=10">button</button>
        <p>比原价贵了{{expensive}}元</p>
    </div>
    
    <script>
        let app = new Vue({
            el:"#app",
            data:{
                price:100,
                expensive:0,
                rePrice:100
            },
            watch:{
                price(newPrice,oldPrice){
                    this.expensive = newPrice - this.rePrice
                }
            }
        })
    </script>
</body>
</html>